import request from '@/utils/request'

// 查询用车订单列表
export function listInfo (query) {
  return request({
    url: '/order/info/list',
    method: 'get',
    params: query
  })
}

// 查询用车订单详细
export function getInfo (id) {
  const params = {
    'id': id
  }
  return request({
    url: '/order/info/getInfo',
    method: 'get',
    params: params
  })
}

// 新增用车订单
export function addInfo (data) {
  return request({
    url: '/order/info/insert',
    method: 'post',
    data: data
  })
}

// 修改用车订单
export function updateInfo (data) {
  return request({
    url: '/order/info/update',
    method: 'post',
    data: data
  })
}

// 删除用车订单
export function delInfo (id) {
  const params = {
    'id': id
  }
  return request({
    url: '/order/info/delete',
    method: 'post',
    params: params
  })
}
// 批量删除用车订单
export function delBatchInfo (ids) {
  const params = {
    'ids': ids
  }
  return request({
    url: '/order/info/deleteBatch',
    method: 'post',
    params: params
  })
}

// 导入用车订单
export function importData (data) {
  return request({
    url: '/order/info/importData',
    method: 'post',
    data: data
  })
}

// 接单页面-根据车型ID查询车辆数组
export function getCarType (query) {
  return request({
    url: '/car/info/list/by/car/type',
    method: 'get',
    params: query
  })
}

// 接单页面-根据车辆ID查询司机数组
export function getByCar (query) {
  return request({
    url: '/driver/info/list/by/car',
    method: 'get',
    params: query
  })
}

// 物流公司接单接口
export function acceptOrder (params) {
  return request({
    url: '/order/info/accept/order',
    method: 'post',
    data: params
  })
}

// 接单页面-用车申请详情
export function getVehicleInfo (query) {
  return request({
    url: '/useVehicle/info/order/vehicle/info',
    method: 'get',
    params: query
  })
}

// 物流公司拒绝接单接口
export function refuseOrder (params) {
  return request({
    url: '/order/info/refuse/order',
    method: 'post',
    data: params
  })
}

// 车辆变更页面-待修改车辆信息
export function getChangeInfo (query) {
  return request({
    url: '/order/info/wait/change/info',
    method: 'get',
    params: query
  })
}


// 物流公司更换车辆接口
export function changeOrder (params) {
  return request({
    url: '/order/info/change/order',
    method: 'post',
    data: params
  })
}

// 查询超时用车单列表列表
export function getListByStatus(params,status) {
  return request({
    url: `/order/info/getListByStatus/${status}`,
    method: 'get',
    params: params
  })
}

// 手动重新分派
export function redirectVehicle (data) {
  return request({
    url: '/api/dingtalk/redirectVehicle',
    method: 'post',
    data: data
  })
}

// 根据用车id、耗材类型查询品质损失明细
export function materialList (query) {
  return request({
    url: '/vehicle/material/list/by/type/and/vehicleId',
    method: 'get',
    params: query
  })
}